﻿using System;

class TravelPriceCalculator
{
    // 计算旅游总费用
    public static double CalculatePrice(int adultCount, int childCount)
    {
        const double adultPrice = 300;   // 成人票价
        const double childPrice = 150;   // 儿童票价
        const double groupDiscount = 0.9; // 团购折扣（9折）
        
        // 计算基础总价
        double totalPrice = adultCount * adultPrice + childCount * childPrice;
        
        // 如果总人数不少于5人，应用团购折扣
        if (adultCount + childCount >= 5)
        {
            totalPrice *= groupDiscount;
        }
        
        return totalPrice;
    }
    
    public static void Run()
    {
        Console.Write("请输入成人人数：");
        if (!int.TryParse(Console.ReadLine(), out int adults) || adults < 0)
        {
            Console.WriteLine("输入的成人人数无效");
            return;
        }
        
        Console.Write("请输入儿童人数：");
        if (!int.TryParse(Console.ReadLine(), out int children) || children < 0)
        {
            Console.WriteLine("输入的儿童人数无效");
            return;
        }
        
        double total = CalculatePrice(adults, children);
        Console.WriteLine($"旅游总费用为：{total:F2}元");
    }
}

